package com.zbs.framework.common.enums;

import com.alibaba.fastjson.parser.DefaultJSONParser;
import com.alibaba.fastjson.parser.JSONToken;
import com.alibaba.fastjson.parser.deserializer.ObjectDeserializer;

import java.lang.reflect.Type;

/**
 * @Author: JeffGao
 * @Date: Created in 2020/2/25
 * @Description:
 */
public class EnumDeserializer implements ObjectDeserializer {
    @Override
    public <T> T deserialze(DefaultJSONParser parser, Type type, Object o) {
        return parser.getRawReader().read(type);

    }

    @Override
    public int getFastMatchToken() {
//        return 0;
        return JSONToken.LITERAL_INT;
    }
}